# Actions for Canon Printers
# Example file with some options (ink level reporting, cartrige changing (caution!)) to try.
#
# Printer has following cartridges:
# - Black
# - Colour Cyan, Magenta, Yellow
#
# Created 05-05-2005 T. Milius, D. Thielsch
# Changed 10-01-2005 T. Milius              get command with new Canon length
# Changed 03-29-2006 T. Milius              Low Ink message at yellow and
#                                           cyan cartridges swapped
# Changed 03-30-2006 D. Webb, T. Milius     Ink level for low ink message
#                                           at yellow and cyan cartridges swapped
#
GetCartridgeInfo:
hide 0 upwards
send 27,"[","K",12,0,0,30,0,10,"S","S","R","=","C","I","R",";"
get -2
split RESPONSE COL_0 COL_1 COL_2 COL_3 # CIR:K=%d,C=%d,M=%d,Y=%d;
eval COL_0 COL_0 # %0 * 10
eval COL_1 COL_1 # %0 * 10
eval COL_2 COL_2 # %0 * 10
eval COL_3 COL_3 # %0 * 10
show 0 <PrtInfo$Dir>.Resources.Cartridges.Canon.S500
send 27,"[","K",12,0,0,30,0,10,"S","S","R","=","D","W","S",";"
get -2
split RESPONSE MESSAGE # %[^;]
split RESPONSE TEXT_0 # DWS:%[^;]
cgorel 22 TEXT_0 # %0="NO" OR %0="UK"
eval INT_0 # 0
eval TEXT_0 # ""
split RESPONSE INT_0 TEXT_0 # DWS:%x,%[^;]
cgorel 2 INT_0 # %0 <> &1501
show 1 <PrtInfo$Dir>.Resources.Warnings.Canon.S500.LOW_B
eval COL_0 # 50
cgorel 2 INT_0 # %0 <> &1511
show 2 <PrtInfo$Dir>.Resources.Warnings.Canon.S500.LOW_Y
eval COL_3 # 50
cgorel 2 INT_0 # %0 <> &1512
show 3 <PrtInfo$Dir>.Resources.Warnings.Canon.S500.LOW_M
eval COL_2 # 50
cgorel 2 INT_0 # %0 <> &1513
show 4 <PrtInfo$Dir>.Resources.Warnings.Canon.S500.LOW_C
eval COL_1 # 50
cgorel 5 TEXT_0 # (LEN %0)=0
eval RESPONSE TEXT_0 # %0
eval INT_0 # 0
eval TEXT_0 # ""
split RESPONSE INT_0 TEXT_0 # %x,%[^;]
cgorel -14 # 1=1
show 0 <PrtInfo$Dir>.Resources.Cartridges.Canon.S500
End 
# 
ChangeCartridge: 31
hide 0 upwards
eval INT_0 # 0
cgorel 3 INT_0 # <Territory><>7 OR %0=1
eval DIALOGMESSAGE # "Wollen sie die Patrone wirklich wechseln?"
ask Fortfahren Abbrechen
eval INT_0 # 1
cgorel 3 INT_0 # <Territory><>35 OR %0=1
eval DIALOGMESSAGE # "Wollen sie die Patrone wirklich wechseln?"
ask Fortfahren Abbrechen
eval INT_0 # 1
cgorel 2 INT_0 # %0=1
eval DIALOGMESSAGE # "Do you really want to change the cartridge?"
ask Continue Cancel
cgorel 50 DIALOGRESULT # %0=4
send 27,"[","K",2,0,0,31,"B","J","L","S","T","A","R","T",10
send "@","C","h","a","n","g","e","T","a","n","k","=","C","o","l","o","r","K",10
send "B","J","L","E","N","D",10
End
# 
ChangeCartridge: 32
hide 0 upwards
eval INT_0 # 0
cgorel 3 INT_0 # <Territory><>7 OR %0=1
eval DIALOGMESSAGE # "Wollen sie die Patrone wirklich wechseln?"
ask Fortfahren Abbrechen
eval INT_0 # 1
cgorel 3 INT_0 # <Territory><>35 OR %0=1
eval DIALOGMESSAGE # "Wollen sie die Patrone wirklich wechseln?"
ask Fortfahren Abbrechen
eval INT_0 # 1
cgorel 2 INT_0 # %0=1
eval DIALOGMESSAGE # "Do you really want to change the cartridge?"
ask Continue Cancel
cgorel 50 DIALOGRESULT # %0=4
send 27,"[","K",2,0,0,31,"B","J","L","S","T","A","R","T",10
send "@","C","h","a","n","g","e","T","a","n","k","=","C","M","Y",10
send "B","J","L","E","N","D",10
End
# 
CleanHead: 31
hide 0 upwards
send 27,"[","K",2,0,0,31,"B","J","L","S","T","A","R","T",10
send "@","C","l","e","a","n","i","n","g","=","1","K",10
send "B","J","L","E","N","D",10
End
#
CleanHead: 32
hide 0 upwards
send 27,"[","K",2,0,0,31,"B","J","L","S","T","A","R","T",10
send "@","C","l","e","a","n","i","n","g","=","1","C","M","Y",10
send "B","J","L","E","N","D",10
End
# Status is obtained by USB printer class request
GetStatus: USB
eval MESSAGE MANUFACTURER PRINTERTYPE # %0 + " " + %1
End
# Status is obtained by parallel interface
GetStatus: Parallel
eval MESSAGE MANUFACTURER PRINTERTYPE # %0 + " " + %1
End
# Reset is done by USB printer class request
ResetPrinter: USB
End
# Reset is done by Parallel interface
ResetPrinter: Parallel
End
#
PrintTestpattern:
eval INT_0 # 0
cgorel 3 INT_0 # <Territory><>7 OR %0=1
eval DIALOGMESSAGE # "Bitte Papier einlegen!"
ask Gemacht Abbrechen
eval INT_0 # 1
cgorel 3 INT_0 # <Territory><>35 OR %0=1
eval DIALOGMESSAGE # "Bitte Papier einlegen!"
ask Gemacht Abbrechen
eval INT_0 # 1
cgorel 2 INT_0 # %0=1
eval DIALOGMESSAGE # "Please insert paper!"
ask Done Cancel
cgorel 50 DIALOGRESULT # %0=4
send 27,"[","K",2,0,0,31,"B","J","L","S","T","A","R","T",10
send "@","T","e","s","t","P","r","i","n","t","=","N","o","z","z","l","e","C","h","e","c","k",10
send "B","J","L","E","N","D",10
End
#
Init:
action GetStatus:
End
